package text111;

public class Solution28 {
    public int[] twoSum(int[] nums, int target) {
    	int res[] =new int[2];
    	int left = 0;
    	int right = nums.length-1;
    	while(left<right) {
    		if ((nums[left]+nums[right])<target) {
				left++;
			}else if ((nums[left]+nums[right])>target) {
				right--;
			}else {
				res[0] = nums[left];
				res[1] = nums[right];
				break;
			}
    	}
		return res;
    }
}
